/**
 *  操作按钮
 */
import 'package:flutter_benchu/utils/commonPkg.dart';

class ButtonItem extends StatelessWidget {
  // 继承父级参数
  ButtonItem({Key key, @required this.title, this.onPressed, this.bgColor,this.color}) : super(key: key);
  // 数组列表
  final String title;                     //名称
  final double marginBottom = 20.0.w;     //底部边距
  final Function onPressed;               //回调
  Color bgColor = LightColors.red;        //颜色
  Color color = Colors.white;             //文字颜色

  @override
  Widget build(BuildContext context) {
    bgColor = bgColor??LightColors.red;
    color = color??Colors.white;
    return Container(
        width: 375.w,
        height: 52.w,
        padding: EdgeInsets.fromLTRB(14.0.w, 0, 14.0.w, 0), //左上右下
        margin: EdgeInsets.fromLTRB(0, 0, 0, marginBottom),
        child: RaisedButton(
          child: Text(title,style: TextStyle(color: color),
          ),
          color: bgColor,
          onPressed: () {
            if (onPressed != null) onPressed();
          },
        ));
  }
}
